From 7f6310847d78fde5c8b024f52cdcee88057d54c5 Mon Sep 17 00:00:00 2001 From: Tobias Date: Wed, 10 Feb 2010 13:08:24 +0000 Subject: [PATCH] showLogExtract of block log on user (talk) pages of blocked users --- includes/Article.php | 17 ++++++++++++++++- includes/EditPage.php | 20 ++++++++++++++++++-- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index f575df1420..f7b126d9ec 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1208,7 +1208,7 @@ class Article { public function showMissingArticle() { global $wgOut, $wgRequest, $wgUser; - # Show info in user (talk) namespace. Does the user exist? + # Show info in user (talk) namespace. Does the user exist? Is he blocked? if ( $this->mTitle->getNamespace() == NS_USER || $this->mTitle->getNamespace() == NS_USER_TALK ) { $parts = explode( '/', $this->mTitle->getText() ); $rootPart = $parts[0]; @@ -1217,6 +1217,21 @@ class Article { if ( $id == 0 && !$ip ) { # User does not exist $wgOut->wrapWikiMsg( "
\n\$1
", array( 'userpage-userdoesnotexist-view', $rootPart ) ); + } else if (User::newFromId($id)->isBlocked()) { # Show log extract if the user is currently blocked + LogEventsList::showLogExtract( + $wgOut, + 'block', + $this->mTitle->getSubjectPage()->getPrefixedText(), + '', + array( + 'lim' => 1, + 'showIfEmpty' => false, + 'msgKey' => array( + 'sp-contributions-blocked-notice', + $this->mTitle->getSubjectPage()->getPrefixedText() # Support GENDER in notice + ) + ) + ); } } wfRunHooks( 'ShowMissingArticle', array( $this ) ); diff --git a/includes/EditPage.php b/includes/EditPage.php index 224764f01a..657c46e375 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -765,15 +765,31 @@ class EditPage { $wgOut->wrapWikiMsg( "
\n$1
", 'editinginterface' ); } - # Show a warning message when someone creates/edits a user (talk) page but the user does not exists + # Show a warning message when someone creates/edits a user (talk) page but the user does not exist + # Show log extract when the user is currently blocked if ( $namespace == NS_USER || $namespace == NS_USER_TALK ) { $parts = explode( '/', $this->mTitle->getText(), 2 ); $username = $parts[0]; $id = User::idFromName( $username ); $ip = User::isIP( $username ); - if ( $id == 0 && !$ip ) { + if ( $id == 0 && !$ip ) { # User does not exist $wgOut->wrapWikiMsg( "
\n$1
", array( 'userpage-userdoesnotexist', $username ) ); + } else if (User::newFromId($id)->isBlocked()) { # Show log extract if the user is currently blocked + LogEventsList::showLogExtract( + $wgOut, + 'block', + $this->mTitle->getSubjectPage()->getPrefixedText(), + '', + array( + 'lim' => 1, + 'showIfEmpty' => false, + 'msgKey' => array( + 'sp-contributions-blocked-notice', + $this->mTitle->getSubjectPage()->getPrefixedText() # Support GENDER in notice + ) + ) + ); } } # Try to add a custom edit intro, or use the standard one if this is not possible. -- 2.20.1